import numpy as np  # useful for many scientific computing in Python
import pandas as pd # primary data structure library
import warnings
warnings.filterwarnings('ignore')
import folium
import folium.plugins as plugins
from folium.plugins import HeatMap


# --------------------------define the world map-----------------------
world_map = folium.Map()
# display world map
world_map

# ----------------------------Heatmap movement Example-------------------------
# 
# - Let us use HeatMap plugin to generate an animation in Folium

#Define a random seed
np.random.seed(3141592)
Number=50
#Generate random data around latitude = 23 (Tropic of Cancer) longitude of 77
initial_data = (
    np.random.normal(size=(Number, 2)) * np.array([[1, 1]]) +
    np.array([[23, 77]])
)
#Generate Heatmap movement dataset
move_data = np.random.normal(size=(Number, 2)) * 0.02
data = [(initial_data + move_data * i).tolist() for i in range(Number)]
weight = 1  # default value
for time_entry in data:
    for row in time_entry:
        row.append(weight)
print("data")
print(data)
print("data.shape")
print(data.shape)
#Define the Folium Map
hmwtMap = folium.Map([23., 77.], tiles='OpenStreetMap', zoom_start=4)
#Add the Heatmap data to HeatMapWithTime plugin        
hmwtPlugin = plugins.HeatMapWithTime(data)
hmwtPlugin.add_to(hmwtMap)
#Render the Finished Map

hmwtMap


#------------------------------------Heatmap----------------------
data = (
    np.random.normal(size=(100, 3)) *
    np.array([[1, 1, 1]]) +
    np.array([[28, 77, 1]])
).tolist()
# SimpleHmDataMap = folium.Map([28., 77.], tiles='OpenStreetMap', zoom_start=6)
# SimpleHmDataMap = folium.Map([28., 77.], tiles='OpenStreetMap', zoom_start=20)
# SimpleHmDataMap = folium.Map([28., 100.], tiles='OpenStreetMap', zoom_start=6)
SimpleHmDataMap = folium.Map([28., 77.], tiles='OpenStreetMap', zoom_start=6)
# Map([28., 77.] 一开始 的经纬度吧
HeatMap(data).add_to(SimpleHmDataMap)
# SimpleHmDataMap.save("Simple Example.html")
# ', zoom_start=20) 一开始就放的很大
# SimpleHmDataMap.save("Simple Example_zoom_start20.html")
SimpleHmDataMap.save("Simple Example_mqp_77.html")
SimpleHmDataMap